{{define "title"}}Edit Post - Admin{{end}}

{{define "body"}}
<form method="post" action="/admin/post/edit{{if .ModifyPost}}?id={{.PostID}}{{end}}" >
<label for="post_title">Title</label>
<input type="text" name="postTitle"
					    id="post_title" value="{{with .Post}}{{.Title}}{{end}}" />
        <textarea id="post_content" name="postContent"
	style="width:80%">{{with .Post}}{{.StringContent}}{{end}}</textarea>
	<br />
<span>Category</span>[{{with .Post}}{{with .CategoryTerm}}{{.Name}}{{end}}{{end}}]
{{ $categoryList := .TermCategoryMap.category }}
{{ $tagList := .TermCategoryMap.post_tag }}

{{range $c := $categoryList}}
<input name="postCategory" type="radio" value="{{$c.ID}}" />{{$c.Name}}
{{end}}
<br />
<span>Tag</span>
{{range $tag := $tagList}}
<input name="postTag" type="checkbox" value="{{$tag.Name}}" />{{$tag.Name}}
{{end}}

<br/>
<input type="checkbox" name="postPublished" value="published"{{with .Post}}{{if .Published}}checked="checked"{{end}}{{end}} /> Published
<br/>
<input name="submit" type="submit" value="Save" />
</form>
{{end}}

{{define "extrahead"}}{{end}}

{{define "extrabody"}}
<script type="text/javascript" src="/static/js/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
$(function(){
tinyMCE.init({
        // General options
        mode : "textareas",
//        mode: "exact",
//        element: "content3", 
        theme : "advanced"
});});
</script>
{{end}}
